package manager;

import entity.Account;
import database.AccountManagerDB;
import database.ClassManagerDB;
import database.ClassRoomBlockManagerDB;
import database.Connection;
import database.MarkManagerDB;
import database.PointTypeManagerDB;
import database.ProvinceManagerDB;
import database.SemesterManagerDB;
import database.StudentManagerDB;
import database.TeacherClassDetailsManagerDB;
import database.SubjectManagerDB;
import database.TeacherManagerDB;

/**
 *
 * @author Noi
 */
public class Manager {

    public Manager() {
        this.conn = new Connection();
        this.accountManager = new AccountManager();
        this.accountManagerDB = new AccountManagerDB(conn.getConn());
        this.accountManagerDB.loadData(accountManager);
    }

    public void setAccount(Account account) {
        this.account = account;
        this.initManagers();
        this.loadDataToManagers();
    }

    private void initManagers() {
            this.classManager = new ClassManager();
            this.classRoomBlockManager = new ClassRoomBlockManager();
            this.markManager = new MarkManager();
            this.provinceManager = new ProvinceManager();
            this.semesterManager = new SemesterManager();
            this.studentManager = new StudentManager();
            this.teacherClassDetailsManager = new TeacherClassDetailsManager();
            this.subjectManager = new SubjectManager();
            this.teacherManager = new TeacherManager();
            this.pointTypeManager = new PointTypeManager();
    }

    private void loadDataToManagers() {
            this.classManagerDB = new ClassManagerDB(conn.getConn());
            this.classRoomBlockManagerDB = new ClassRoomBlockManagerDB(conn.getConn());
            this.markManagerDB = new MarkManagerDB(conn.getConn());
            this.provinceManagerDB = new ProvinceManagerDB(conn.getConn());
            this.semesterManagerDB = new SemesterManagerDB(conn.getConn());
            this.studentManagerDB = new StudentManagerDB(conn.getConn());
            this.teacherClassDetailsManagerDB = new TeacherClassDetailsManagerDB(conn.getConn());
            this.subjectManagerDB = new SubjectManagerDB(conn.getConn());
            this.teacherManagerDB = new TeacherManagerDB(conn.getConn());
            this.pointTypeManagerDB = new PointTypeManagerDB(conn.getConn());

            this.classManagerDB.loadData(this.classManager);
            this.classRoomBlockManagerDB.loadData(this.classRoomBlockManager);
            this.markManagerDB.loadData(this.markManager);
            this.provinceManagerDB.loadData(this.provinceManager);
            this.semesterManagerDB.loadData(this.semesterManager);
            this.studentManagerDB.loadData(this.studentManager);
            this.teacherClassDetailsManagerDB.loadData(this.teacherClassDetailsManager);
            this.subjectManagerDB.loadData(this.subjectManager);
            this.teacherManagerDB.loadData(this.teacherManager);
            this.pointTypeManagerDB.loadData(this.pointTypeManager);
    }

    public AccountManager getAccountManager() {
        return accountManager;
    }

    public ClassManager getClassManager() {
        return classManager;
    }

    public ClassRoomBlockManager getClassRoomBlockManager() {
        return classRoomBlockManager;
    }

    public MarkManager getMarkManager() {
        return markManager;
    }

    public ProvinceManager getProvinceManager() {
        return provinceManager;
    }

    public SemesterManager getSemesterManager() {
        return semesterManager;
    }

    public StudentManager getStudentManager() {
        return studentManager;
    }

    public TeacherClassDetailsManager getSubjectDetailsManager() {
        return teacherClassDetailsManager;
    }

    public SubjectManager getSubjectManager() {
        return subjectManager;
    }

    public TeacherManager getTeacherManager() {
        return teacherManager;
    }

    public AccountManagerDB getAccountManagerDB() {
        return accountManagerDB;
    }

    public ClassManagerDB getClassManagerDB() {
        return classManagerDB;
    }

    public ClassRoomBlockManagerDB getClassRoomBlockManagerDB() {
        return classRoomBlockManagerDB;
    }

    public MarkManagerDB getMarkManagerDB() {
        return markManagerDB;
    }

    public ProvinceManagerDB getProvinceManagerDB() {
        return provinceManagerDB;
    }

    public SemesterManagerDB getSemesterManagerDB() {
        return semesterManagerDB;
    }

    public StudentManagerDB getStudentManagerDB() {
        return studentManagerDB;
    }

    public TeacherClassDetailsManagerDB getTeacherClassDetailsManagerDB() {
        return teacherClassDetailsManagerDB;
    }

    public TeacherClassDetailsManager getTeacherClassDetailsManager() {
        return teacherClassDetailsManager;
    }

    public SubjectManagerDB getSubjectManagerDB() {
        return subjectManagerDB;
    }

    public TeacherManagerDB getTeacherManagerDB() {
        return teacherManagerDB;
    }

    public PointTypeManager getPointTypeManager() {
        return pointTypeManager;
    }

    public PointTypeManagerDB getPointTypeManagerDB() {
        return pointTypeManagerDB;
    }
    private AccountManager accountManager;
    private ClassManager classManager;
    private ClassRoomBlockManager classRoomBlockManager;
    private MarkManager markManager;
    private ProvinceManager provinceManager;
    private SemesterManager semesterManager;
    private StudentManager studentManager;
    private TeacherClassDetailsManager teacherClassDetailsManager;
    private SubjectManager subjectManager;
    private TeacherManager teacherManager;
    private PointTypeManager pointTypeManager;
    private AccountManagerDB accountManagerDB;
    private ClassManagerDB classManagerDB;
    private ClassRoomBlockManagerDB classRoomBlockManagerDB;
    private MarkManagerDB markManagerDB;
    private ProvinceManagerDB provinceManagerDB;
    private SemesterManagerDB semesterManagerDB;
    private StudentManagerDB studentManagerDB;
    private TeacherClassDetailsManagerDB teacherClassDetailsManagerDB;
    private SubjectManagerDB subjectManagerDB;
    private TeacherManagerDB teacherManagerDB;
    private PointTypeManagerDB pointTypeManagerDB;
    private Connection conn;
    private Account account;
}